﻿using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GMusicUtil.Common.Data
{
    partial class MusicEntities
    {
        public MusicEntities(string databasePath)
            //: base(CreateConnectionStringFromPath(databasePath))
        {
            Database.Connection.ConnectionString = string.Format("data source={0}", databasePath);
        }

        private static SQLiteConnection CreateConnectionFromPath(string databasePath)
        {
            return new SQLiteConnection(string.Format("data source={0}", databasePath));
        }

        private static string CreateConnectionStringFromPath(string databasePath)
        {
            return string.Format("metadata=res://*/Data.MusicModel.csdl|res://*/Data.MusicModel.ssdl|res://*/Data.MusicModel.msl;provider=System.Data.SQLite;provider connection string=&quot;data source={0}&quot;", databasePath);
        }
    }
}
